<template>
  <el-row type="flex" justify="center">
    <div id="radar" ref="myRadar" />
  </el-row>
</template>

<script>
import * as echarts from 'echarts/core'
import {
  RadarChart
} from 'echarts/charts'
import {
  CanvasRenderer
} from 'echarts/renderers'

echarts.use(
  [RadarChart, CanvasRenderer]
)
export default {
  mounted() {
    // 基于准备好的dom，初始化echarts实例
    const myChart = echarts.init(this.$refs.myRadar)
    // 绘制图表
    myChart.setOption({
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '天津', max: 6500 },
          { name: '上海', max: 16000 },
          { name: '广州', max: 30000 },
          { name: '深圳', max: 38000 },
          { name: '武汉', max: 52000 },
          { name: '北京', max: 25000 }
        ]
      },
      series: [{
        type: 'radar',
        data: [
          {
            value: [4200, 3000, 20000, 35000, 50000, 18000],
            name: '预算分配（Allocated Budget）'
          },
          {
            value: [5000, 14000, 28000, 26000, 42000, 21000],
            name: '实际开销（Actual Spending）'
          }
        ]
      }]
    })
  }
}
</script>

<style lang="scss" scoped>
#radar {
  width: 500px;
  height: 400px;
}
</style>
